<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:40:"./views/home/mobile/recharge\index.phtml";i:1626541392;s:67:"E:\Web\test.zztuku.com\public\views\home\mobile\common\header.phtml";i:1541935408;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>充值</title>
    <link rel="shortcut icon" href="clientapp/images/new_images/favicon.ico" />
<link href="/static/home/mobile/css/reset_5.css" rel="stylesheet" type="text/css" />
<link href="/static/home/mobile/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="/static/home/mobile/css/font-awesome.min.css">
<link href="/static/home/mobile/css/new_style.css" rel="stylesheet" type="text/css" />
<!-- 弹出层 -->
<link rel="stylesheet" href="/static/plugins/dialog/css/dialog.css" />
<script src="/static/home/mobile/js/jquery-2.0.3.min.js"></script>
<script src="/static/plugins/dialog/js/dialog.js"></script>
<!-- 弹出层 -->
<script type="text/javascript" src="/static/plugins/clipboard.min.js"></script>
<script type="text/javascript" src="/static/home/mobile/js/global.js?v=2"></script>
    <link rel="stylesheet" href="/static/home/mobile/css/home.css" />
    <link rel="stylesheet" href="/static/home/mobile/css/iconfont.css" />
      <script src="/static/home/mobile/js/jsbridge-mini.js"></script>
	<style>
		.gBorder{
			border:2px solid #2f62ff;
		}
		#main{
    width: 100%;
    height: 100%;
    display: none;
  }
  #dialog{
    border-radius: 15px;
    text-align: center;
    width: 70%;
    height: 50%;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    background-color: white;
  }
  .box{
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background: rgba(0,0,0,0.3);
  }
  
	</style>

  
    
    
</head>
<body>
    
<div id="main">
 
      <div class="box" v-if="vm.dialogShow">
        <div id="dialog" >
            <img style="width:60%;height:60%;margin-top:10%;" id="erweima" />
            <p id="yanzhengma"></p>
            <p id="yanzhengma">扫码付款请备注验证码！</p>
            <div style="background-color:#cb7d7d;width:40%;margin-left:30%;border-radius:5px;" id="guanbi">关闭</div>
        <div style="background-color:#5cd6c2;width:40%;margin-left:30%;border-radius:5px;margin-top:5%;" onclick="quchongzhi()">确定</div>
        </div>
        
      </div>
</div>

	<div class="wap">
		<!--header start-->
		<div class="header">
	   	   <span <a onclick="history.back()" class="back" style="background:none;margin-top:0px;" >
            <img style="height:24px;" src='/static/home/mobile/images/return2.png'></span>
			&nbsp&nbsp我的钱包
			<a href="/home/charge.html">流水</a>
		</div>
		<!--header end-->
		<div style="clear: both;"></div>
		<!--wallet start-->
		<div class="wallet">
			<dl><a href="/home/account/rechargelog.html">充值记录</a></dl>
			<dd>
				钱包余额
				<b><?php echo $member['credit2']; ?></b>
			</dd>
			<span><a></a></a></span>
		</div>
		<!--wallet end-->
		<div style="clear: both;"></div>
		<!--money start-->
		<div class="money">
			<div class="tt">充值金额</div>
			<ul>
				<li><a href="#" onclick="chooseMoney(20,this)">￥<b>20</b></a></li>
				<li><a href="#" onclick="chooseMoney(30,this)">￥<b>30</b></a></li>
				<li><a href="#" onclick="chooseMoney(50,this)" >￥<b>50</b></a></li>
				<li><a href="#" onclick="chooseMoney(80,this)" >￥<b>80</b></a></li>
				<li><a href="#" onclick="chooseMoney(100,this)" >￥<b>100</b></a></li>
				<li><input onclick="chooseMoney(0,this)" type="text" id="self"  name="money" placeholder="自定义金额" /></li>
			</ul>
		</div>
		<!--money end-->
		<div style="clear: both;"></div>
		<!--pay start-->
		<div class="pay">
			<div class="tt">充值方式</div>
				<label onclick="choose_type(2,this)">
					<i class="iconfont icon-weixinzhifu"></i>微信支付
					<input type="radio" name="RadioGroup1" checked = "checked" value="单选" id="RadioGroup1_0" />
				</label>
				<label onclick="choose_type(1,this)">
					<i class="iconfont icon-zhifubao"></i>支付宝支付
					<input type="radio" name="RadioGroup1" value="单选" id="RadioGroup1_1" />
				</label>
		</div>
		<input type="hidden" id="order_no"/>
		<!--pay end-->
		<div style="clear: both;"></div>
		<div class="confirm button2"><input type="button" value="立即充值"></div>
	</div>
	<script>
		var realMoney=0;
		var payType=0;
		function chooseMoney(money,e){
			console.log($(this))
			realMoney=money;
			$(e).parent().parent().find('a').removeClass('gBorder')
			$(e).addClass('gBorder')
		}
		
		function choose_type(type,e){
			console.log($(this))
			payType=type;
			$(e).siblings().removeClass('gBorder')
			$(e).addClass('gBorder')
		}
	</script>
<script>
        var interval;
        var is_query=0;
        
        $(function () {
            $('.button2').click(function () {
                var credit2 = realMoney;
				if(!credit2){
					credit2=$('#self').val()
				}
              if(credit2<20){
                  alert('充值金额最低20元');return false;
              }
              if(!payType){
              	alert('请选择充值方式') 
              	return;
              }
                var floatReg = /^\d+(\.\d+)?$/;
                if (!floatReg.test(credit2)) {
                    message('请输入正确格式的充值金额','','error');
                    event.preventDefault();//  阻止元素发生默认的行为
                    return;
                }

                var all_data=$('form').serialize();
                if(payType === 2){
                    location.href="/home/hupijiao/pay?amount="+credit2;
                }else if(payType === 1){
                    //支付宝
                    location.href="/home/alipay/pay?amount="+credit2;
                }
                // $.ajax({
                //     //几个参数需要注意一下
                //     type: "POST",//方法类型
                //     dataType: "json",//预期服务器返回的数据类型
                //     url: "/home/recharge/preRecharge" ,//url   /home/register/sendsmscode
                //     data: {credit2:credit2,type:payType},
                //     success: function (result) {
                //         console.log(result);//打印服务端返回的数据(调试用)
                //         if (result.code == 1) {
                //             $('#order_no').val(result.data.order_no);
                //             $('#erweima').attr('src',result.data.erweima);
                //             $('#yanzhengma').html('充值验证码：'+result.data.uid);
                //             $('#main').css('display','block');
                //         } else {
                //             message(result.message,'','error');
                //         }
                //     },
                //     error : function(err) {
                //     	console.log(err)
                //         alert("异常！");
                //     }
                // });
            });
        });
        $('#guanbi').click(function(){
            $('#main').css('display','none');
        })
        function quchongzhi(){
            $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "/home/recharge/cztj" ,
                    data: {order_no:$('#order_no').val()},
                    success: function (result) {
                        message(result.message,'reload','success');
                    },
                    error : function(err) {
                    	console.log(err)
                    }
                });
        }

        function getResult(order_no){

             $.ajax({
                    //几个参数需要注意一下
                        type: "POST",//方法类型
                        dataType: "json",//预期服务器返回的数据类型
                        url: "/home/recharge/order_query" ,//url   /home/register/sendsmscode
                        data: {order_no:order_no},
                        success: function (result) {
                        	is_query=0;
							console.log(result)
                                if(result.code==1){
                            		Common.loading.hide();
                                    
                                    clearInterval(interval);
                                    alert('支付成功')
                                    location.reload()
                                }else{
                                  //  alert(data.msg)

                                }

                        },
                        error : function() {
                                clearInterval(interval);
                            alert("异常！");
                        }

                    })
        }	

	
	
</script>
</body>
</html>